package com.sh.ssao.lottery.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 自动填充数据
 */
@Component
@Slf4j
public class DmsMetaObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        log.info("新增插入数据");
        this.setFieldValByName("dmsCreateTime",new Date(),metaObject);
        this.setFieldValByName("dmsUpdateTime",new Date(),metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        log.info("更新插入数据");
        this.setFieldValByName("dmsUpdateTime",new Date(),metaObject);
    }
}
